package com.ictravi.iamunit.connector;

import java.util.Map;
import java.util.HashMap;
import com.ictravi.iamunit.ConfigLoader;

/**
 * Holds credential data for the target system
 * 
 * @author Albert Louw (alouw@ictavi.com)
 * @see ConfigLoader
 */
public class ConnectionConfigData {
	private Map<String, String> configParams = new HashMap<String, String>();
	private Map<String, String> dataSubstitutions;
	private String name;
	private String type;

	/**
	 * Sets the connectionConfigData 
	 * @param name
	 * 			The name of the connector (target)
	 * @param type
	 * 			The type of the connector 
	 * @since v1.0.0
	 */
	public ConnectionConfigData(String name, String type) {
		this.name = name;
		this.type = type;
	}

	/**
	 * Retrieves the name for this current connector
	 * @return String
	 * 			The name of this connector
	 * @since v1.0.0
	 */
	public String getName() {
		return name;
	}

	/**
	 * Get the type of this connector
	 * @return String
	 * 			Type of this connector
	 * @since v1.0.0
	 */
	public String getType() {
		return type;
	}

	/**
	 * Gets a specific parameter by name
	 * @param name
	 * 			Name the parameter to get
	 * @return String
	 * 			The value of this parameter
	 * @since v1.0.0
	 */
	public String getParam(String name) {
		return configParams.get(name);
	}

	/**
	 * Sets a parameter value by name
	 * @param name
	 * 			The name of the parameter to set
	 * @param value
	 * 			The value to set it to
	 * @since v1.0.0
	 */
	public void setParam(String name, String value) {
		configParams.put(name, value);
	}

	/**
	 * Retrieves all parameters for this connector
	 * @return Map
	 * 			String map with all parameter names and values
	 * @since v1.0.0
	 */
	public Map<String, String> getParams() {
		return configParams;
	}

	/**
	 * Retrieves all substitutions for this connector
	 * @return Map
	 * 			String map with all substitution names and values
	 * @since v1.0.0
	 */
	public Map<String, String> getSubstitutions() {
		return dataSubstitutions;
	}

	/**
	 * Sets the substitutions datamap
	 * @param substitutions
	 * 			Datamap values to set
	 * @since v1.0.0
	 */
	public void setSubstitutions(Map<String, String> substitutions) {
		this.dataSubstitutions = substitutions;
	}
}
